package org.red_cross_service.utils;

import org.springframework.beans.factory.annotation.Value;

import java.io.File;

public final class FileUtil {

    @Value("${files.upload.path}")
    private static String fileUploadPath;

    public static Boolean deleteFile(String fileName) {
        // 指定要删除的文件路径
        String filePath = fileUploadPath + fileName;
        // 创建File对象
        File file = new File(filePath);
        // 检查文件是否存在
        if (file.exists()) return file.delete();
        System.out.println("文件不存在: " + filePath);
        return true;
    }
}
